package com.hgl.servlet.admin;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hgl.entity.Hgl;
import com.hgl.service.HglService;
import com.hgl.service.impl.HglServiceImpl;

@WebServlet("/admin/user-list1.let")
public class UserList1Servlet extends HttpServlet {

	private HglService hglservice = new HglServiceImpl();
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

		int current = 1;
		try{
			current = Integer.valueOf(request.getParameter("current"));
		}catch(Exception ex){
		}
		
		int rowMax = 5;
		try{
			rowMax = Integer.valueOf(request.getParameter("rowMax"));
		}catch(Exception ex){
		}
		
		List<Hgl> list = hglservice.list(current, rowMax);
	
		int total = hglservice.count();
		
		request.setAttribute("total", total);
		request.setAttribute("list", list);
		request.getRequestDispatcher("/admin/user-list1.jsp").forward(request, response);
	}
}
